Skip to content

feat(plugins): compose the Android provider interactor - #4728

Closed
thymikee wants to merge 7 commits into
refactor/0.22-limrun-plugin-factoryfrom
refactor/0.22-limrun-android-interactor
Closed

thymikee wants to merge 7 commits into
refactor/0.22-limrun-plugin-factoryfrom
refactor/0.22-limrun-android-interactor

Conversation

@thymikee

@thymikee thymikee commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Validation

  • Head 15c18ec46f52f08342254348370334265e59b186 on base 4b7e61602b331331b9ef6d01881ad1a52d55638a.
  • Exact clean pnpm check:affected --run --head 15c18ec46f52f08342254348370334265e59b186 passed (42 passed, 25 skipped), including packed consumer integration. The scoped provider test exercised both lines missed by the previous hosted Coverage run.
  • Independent source and packed-boundary reviews completed. Hosted checks and live provider acceptance remain pending.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

…ials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.
… facet

The Android facet exposed adb mechanics but not the interactor a provider device
runtime must answer `getInteractor` with, so the Limrun adapter kept its own
static edge to the root's factory and the facet's host authority stopped short of
every command that interactor runs.

The root's facet gains one synchronous `createInteractor`. The root reads the
family's factory once while it builds the capabilities, which is what makes the
operation synchronous: `getInteractor` cannot await, and a lazy edge would need a
proxy interactor instead of this seam. The value is wrapped in the same command
scope every other facet operation re-enters, so a provider that resolves a tool of
its own keeps resolving it from the host the facet was built for, never from the
ambient process or an enclosing request.

The operation is named on the root's own facet type and not on the published
plugin contract. A plugin package bundles that contract into its own declaration,
and a consumer that hands two such packages to `startAgentDevice` compares their
copies of `setup` member by member; an interactor's snapshot answer reaches
`SnapshotViewportSize`, branded with a `unique symbol` no second copy answers to,
so naming one there would stop that consumer compiling. The adapter reads the
operation as an optional facet member and keeps its embedded path, unchanged, when
a caller supplies no capabilities. Its provider conversion is shared with the scope
it already installed, so both arms cross the boundary the same way, and the
provider mirror gains `text`, which the family reads off the provider it installs
its scope over, so a provider with native text entry keeps that route.
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.10 MB 6.10 MB +1.0 kB
Package (unpacked) 6.09 MB 6.10 MB +1.0 kB
Package (download) 1.85 MB 1.85 MB +326 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 26.3 ms 26.4 ms +0.1 ms
CLI --help 56.6 ms 51.1 ms -5.4 ms

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on b2e74a3. The verdict and the full list are in the summary comment.

Comment thread packages/plugins/src/host.ts Resolved
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 15c18ec

Since the review of b2e74a3: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

Reviewed with this repository's own Sentinel configuration (6e18ea334968).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

I found one problem at 15c18ec that needs a live run before merge. CI is green: 16 checks, none failing. There are no conflicts.

Every production Limrun Android getInteractor now builds through the facet instead of the adapter's direct createAndroidInteractor call (limrun-runtime-dependencies.ts#L117). That adds a host-scope wrapper from the registry host, a double exec conversion (toProviderExecutor then asPlatformAdbExecutor), and a provider spread. The PR body says live provider acceptance is pending, and the unit tests use recording facets or local fake executors. So the interaction route of every hosted Limrun Android session changes without a live run. Please record one live Limrun Android session on this head through the daemon (connect limrun --platform android). It should reach snapshot, a fill on a text field (the native text route via adbProvider.text) and press. The CLI output should show these commands succeed on the leased serial. Please add that output to the PR. Please also confirm that the registry host and the builtin host passed to createLimrunRuntimeDependencies are always the same HostEnvironment, because the facet now scopes interactor commands to the registry host instead of the adapter host.

Could Limrun's Android interactor go only through the facet? That would delete the adapter's static createAndroidInteractor import and the embedded fallback, and fail with a typed error when the capability is missing. It removes a core static edge from the adapter, which is the real #3311 step, and leaves one construction path. If extraction cannot use this facet member (the extracted plugin cannot import ProviderAndroidHostWithInteractor from src/), should this PR wait for the extraction PR? Today it changes no behavior. Either way, how would a separately installed @agent-device/limrun get a typed interactor given the unique-symbol brand constraint? A core-owned getInteractor adapter keyed by provider, or an interactor builder that returns an opaque handle core unwraps, would both work. Please record the decision in the #3311 PR or ADR.

The open inline thread on the text request type is fixed at this head: ProviderAndroidTextInjectionRequest is exported from src/sdk/plugins.ts and the packed fixture imports it, so it can be resolved: #4728 (comment)

Not blocking, and fine to take or leave: delete the Object.keys(interactor).length assertion in provider-plugin-host-capabilities.test.ts (and the as unknown as cast in the Limrun facet test), since the keyboardStatus assertion already proves the route. Also keep one brand-boundary explanation at ProviderAndroidHostWithInteractor and reference it from the other comments in host.ts, provider-plugin-host-capabilities.ts and limrun-runtime-dependencies.ts.

Before merge, the live Limrun Android run on 15c18ec is needed, along with an answer on the fallback and extraction question.

@thymikee

Copy link
Copy Markdown
Member Author

I traced the daemon composition at 15c18ec. composeProviderRuntime passes the same HostEnvironment object to builtinProviderCandidates(host) and startProviderRegistry(resolved, host, policy). The built-in candidate closes over that object for createLimrunRuntimeDependencies; the registry passes it to policy.hostCapabilities(host), so the facet’s command scope captures the same object. References: composition, built-in adapter, and registry policy.

I recorded the decision in #3311 to make the interactor cutover in the extraction PR. That change will use one core-owned synchronous adapter bound to the admitted lease and keep the branded interactor internal.

The exact-head hosted Limrun run is still pending. The current T3 device inventory exposes a local host only, with no Limrun Android binding for snapshot, fill and press. The PR remains held for that evidence and the #4720 authority work.

@thymikee

Copy link
Copy Markdown
Member Author

Thanks. That settles the host question: the facet and the adapter close over the same HostEnvironment. The decision to cut over the interactor in the extraction PR is recorded in #3311. The only thing left here is the exact-head hosted Limrun Android run (snapshot, fill, press), along with the #4720 authority work.

@thymikee
thymikee added this pull request to stack #4731 November 19, 2026 08:55
@thymikee
thymikee force-pushed the refactor/0.22-limrun-plugin-factory branch from 254805f to 77435a4 Compare November 19, 2026 09:19
@thymikee

Copy link
Copy Markdown
Member Author

Closing as superseded. #4720 removed the provider host facet that this PR builds on. Per the decision in #3311 (#3311 (comment)), the Android interactor change moves into the extraction cutover: one core-owned adapter bound to the admitted Android lease, with the direct embedded path removed. The live packed Android acceptance (snapshot, fill, press) applies to that PR.

@thymikee thymikee closed this Nov 19, 2026
@thymikee
thymikee deleted the refactor/0.22-limrun-android-interactor branch November 19, 2026 09:55
@thymikee
thymikee removed this pull request from stack #4731 November 19, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant